<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>后台登录</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link rel="stylesheet" href="{{ mix('/css/admin.css') }}">
</head>

<body class="gray-bg top-navigation">
<div class="row white-bg clearfix">
    <nav class="navbar navbar-fixed-top border-bottom">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                        data-target="#app-navbar-collapse">
                    <span class="sr-only">Toggle Navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <span class="navbar-brand"> {{ config('app.name', 'Laravel') }} </span>
            </div>
            <div class="collapse navbar-collapse" id="app-navbar-collapse">
                <ul class="nav navbar-nav">
                    &nbsp;<li class="{{ active_class(if_controller('App\Http\Controllers\Admin\AdminController')) }}"><a
                                href="{{ route('admin.index') }}">管理员设置</a></li>
                    <li class="{{ active_class(if_controller('App\Http\Controllers\Admin\UserController')) }}"><a
                                href="{{ route('user.index') }}">用户管理</a></li>
                </ul>
                <ul class="nav navbar-nav navbar-right">
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
                            {{ Auth::user()->name }} <span class="caret"></span>
                        </a>
                        <ul class="dropdown-menu" role="menu">
                            <li>
                                <a href="{{ route('logout') }}"
                                   onclick="event.preventDefault();
                                                     document.getElementById('logout-form').submit();">
                                    退出
                                </a>
                                <form id="logout-form" action="{{ route('admin.logout') }}" method="POST"
                                      style="display: none;">
                                    {{ csrf_field() }}
                                </form>
                            </li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
    </nav>
</div>
<div class="container">
    @yield('content')
</div>
{{--admin 所有的js文件合并--}}
<script src="{{ mix('/js/admin.js') }}"></script>

{{--一些代码用到了laravel变量，所以不能直接写在js代码中，需要写在视图文件中--}}
<script>
    @if (session('success'))
        toastr.success("{{ session('success') }}");
    @endif
</script>

{{--这里存放自定义的js代码--}}
@yield('js')
</body>
</html>
